package checkXMatrix;

public class Solution {
    public boolean checkXMatrix(int[][] grid) {
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid.length; j++) {
                int t = grid[i][j];
                if(i==j) {
                    if(t==0) {
                        return false;
                    }
                }else if(i == grid.length-j-1) {
                    if(t==0) {
                        return false;
                    }
                }else {
                    if(t!=0) {
                        return false;
                    }
                }
            }
        }
        return true;
    }
}
